#include "behavior_tree_while_do_else_policy.h"
#include <behaviortree_cpp_v3/controls/while_do_else_node.h>

namespace policy
{
BehaviorTreeWhileDoElsePolicy::BehaviorTreeWhileDoElsePolicy(const std::string &name)
    : BehaviorTreePolicy(name)
{
    policy_tree_node_ = std::make_unique<BT::WhileDoElseNode>(name + "_while_do_else_node");
}
BehaviorTreeWhileDoElsePolicy::~BehaviorTreeWhileDoElsePolicy() = default;

bool BehaviorTreeWhileDoElsePolicy::setWhileConditionTask(const task::AbstractTaskConstPtr &task)
{
    return BehaviorTreePolicy::insertTask(0, task);
}
bool BehaviorTreeWhileDoElsePolicy::setWhileConditionPolicy(const AbstractPolicyConstPtr &policy)
{
    return BehaviorTreePolicy::insertPolicy(0, policy);
}
bool BehaviorTreeWhileDoElsePolicy::setThenTask(const task::AbstractTaskConstPtr &task)
{
    return BehaviorTreePolicy::insertTask(1, task);
}
bool BehaviorTreeWhileDoElsePolicy::setThenPolicy(const AbstractPolicyConstPtr &policy)
{
    return BehaviorTreePolicy::insertPolicy(1, policy);
}
bool BehaviorTreeWhileDoElsePolicy::setElseTask(const task::AbstractTaskConstPtr &task)
{
    return BehaviorTreePolicy::insertTask(2, task);
}
bool BehaviorTreeWhileDoElsePolicy::setElsePolicy(const AbstractPolicyConstPtr &policy)
{
    return BehaviorTreePolicy::insertPolicy(2, policy);
}
}
